package com.wenwan.manage.controller;

import java.io.IOException;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.wenwan.manage.service.FileService;

import javax.annotation.Resource;

/**
 * 文件上传
 * 
 * @author Admin
 *
 */
@Controller
@RequestMapping(value = "/file")
public class FileController {

	@Autowired
	private FileService fileService;

	@ResponseBody
	@RequestMapping(value = "/upload/one/file", method = { RequestMethod.POST })
	public Map<String, Object> uploadOneFile(@RequestParam MultipartFile multipartFile) throws IOException {
		return fileService.uploadOneFile(multipartFile.getBytes(), multipartFile.getOriginalFilename());
		// return Util.uploadOneFile(multipartFile);
	}

}